#include "EquationSolver.h"
#include <iostream>
#include <cmath>
//#define M_PI 3.14159265358979323846


double Function :: operator()(double _x)
{
    return (89*sin((11.5/180)*M_PI)*sin(_x)*cos(_x)
    +89*cos((11.5/180)*M_PI)*sin(_x)*sin(_x)
    -((49+0.5*30)*sin((11.5/180)*M_PI)-0.5*30*tan((11.5/180)*M_PI))*cos(_x)
    -((49+0.5*30)*cos((11.5/180)*M_PI)-0.5*30)*sin(_x));
}
double Function :: diff(double _x)
{
    return (89*sin((11.5/180)*M_PI)*cos(2*_x)
    +2*89*cos((11.5/180)*M_PI)*sin(_x)*cos(_x)
    +((49+0.5*30)*sin((11.5/180)*M_PI)-0.5*30*tan((11.5/180)*M_PI))*sin(_x)
    -((49+0.5*30)*cos((11.5/180)*M_PI)-0.5*30)*cos(_x));
};

int main()
{
    Function func;
    Secant sec( 0.0/180*M_PI, 88.0/180*M_PI, 0.0001, 100, func);
    std::cout << sec.solve()/M_PI*180 << std::endl;
    return 0;
};